/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.hazard.supervise.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.hopes.bizz.common.core.util.DateUtils;
import com.hopes.bizz.hazard.supervise.bo.HazSuperviseScoreJson;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

/**
 * 企业分类监管记录
 *
 * @author daijie
 * @date 2024-01-29 14:48:48
 */
@Data
@TableName(value = "haz_classify_supervise_record", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "企业分类监管记录")
public class HazClassifySuperviseRecordEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 分类监管标识
     */
    @Schema(description = "分类监管标识")
    private Long classifySuperviseId;

    /**
     * 扣分项
     */
    @Schema(description = "扣分项")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private HazSuperviseScoreJson scoreJson;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;

    @TableField(exist = false)
    private LocalDateTime dateTime;

    public String getCreateTimeStr() {
        return DateUtils.limitSecond(Date.from(this.getCreateTime().atZone(ZoneId.systemDefault()).toInstant()));
    }
}